home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / util / cli / gengui21.lha / Gengui2.1 / lib / gengui.h < prev    next >
C/C++ Source or Header  |  1995-10-25  |  7KB  |  227 lines

  1.  
  2. #ifndef _GENGUI_LNK_H
  3. #define _GENGUI_LNK_H
  4.  
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8.  
  9. #include <exec/types.h>
  10. #include <libraries/gadtools.h>
  11. #include <proto/gadtools.h>
  12. #include <intuition/gadgetclass.h>
  13.  
  14. #define GG_VBOX -1
  15. #define GG_HBOX -2
  16. #define GG_CUSTOM_KIND -3
  17. #define GG_PLAINTEXT_KIND -4
  18. #define GG_GFXBUTTON_KIND -5
  19.  
  20. #define GG_MODE_NEW     0
  21. #define GG_MODE_RESIZE  1
  22. #define GG_MODE_REFRESH 2
  23. #define GG_MODE_STOP    3
  24. #define GG_MODE_FREE    4
  25. #define GG_MODE_BACKUP  5
  26. #define GG_MODE_RESTORE 6
  27.  
  28. /* Flags for struct GadDim */
  29.  
  30. #define GG_FLAG_CUSTOM              1
  31. #define GG_FLAG_STRING              2
  32. #define GG_FLAG_INTEGER             4
  33. #define GG_FLAG_DISABLED            8
  34. #define GG_FLAG_RAISED             16
  35. #define GG_FLAG_RECESSED           32
  36. #define GG_FLAG_BAR                64
  37. #define GG_FLAG_RESIZED        (1<<10)
  38. #define GG_FLAG_DEFAULT_HEIGHT (1<<11)
  39. #define GG_FLAG_DEFAULT_WIDTH  (1<<12)
  40. #define GG_FLAG_BACKUP         (1<<13)
  41. #define GG_FLAG_SKIPREFRESH    (1<<14)
  42. #define GG_FLAG_INITED         (1<<15)
  43.  
  44. #if 0 /* old values */
  45. #define GG_Left            0
  46. #define GG_Top             0
  47. #define GG_Right       (1<<0)
  48. #define GG_Bottom      (1<<1)
  49. #define GG_HCentered   (1<<2)
  50. #define GG_VCentered   (1<<3)
  51. #define GG_FullSize    (1<<4)
  52. #define GG_NoHighlight (1<<5)
  53. #endif
  54.  
  55. /* These flags superseede some flags for gadgets and gadget-activation,
  56.  * that are not required for simple intuition boolean buttons, but
  57.  * are required for internal use of gengui.
  58.  * (NOTE: The activation flags are shifted 16 bits to the left)
  59.  */
  60.  
  61. #define GG_Left                 0
  62. #define GG_Top                  0
  63. #define GG_Right           0x0200     /* GFLG_TABCYCLE     */
  64. #define GG_Bottom          0x0400     /* GFLG_STRINGEXTEND */
  65. #define GG_HCentered       0x8000     /* GFLG_EXTENDED     */
  66. #define GG_VCentered   0x02000000     /* GACT_STRINGCENTER */
  67. #define GG_FullSize    0x04000000     /* GACT_STRINGRIGHT  */
  68.  
  69. #define GG_NoHighlight GFLG_GADGHNONE /* direct */
  70.  
  71. #define GG_IgnoreFlags (GG_Right|GG_Bottom|GG_HCentered|GG_VCentered|GG_FullSize)
  72.  
  73.  
  74. #define GG_FLAG_TRADEMASK (GG_FLAG_CUSTOM|GG_FLAG_STRING|GG_FLAG_INTEGER)
  75.  
  76. #define GetString(g)   (((struct StringInfo * )g->SpecialInfo)->Buffer)
  77. #define GetNumber(g)   (((struct StringInfo * )g->SpecialInfo)->LongInt)
  78. #define GetInfo(g)     ((struct GadInfo *)((g)->UserData))
  79. #define GetUserData(g) (GetInfo(g)->UserData)
  80. #define GetGadget(msg) ((struct Gadget *)msg->IAddress)
  81.  
  82. struct GadSpace {
  83.    UBYTE Chars,Pix; /* Space in characters / pixels */
  84. };
  85.  
  86. struct GadDim {
  87.    int Kind;
  88.    USHORT Rx,Ry,Cx,Cy,Px,Py;
  89.    USHORT MinCx,MinCy,MinPx,MinPy;
  90.    USHORT SRx,SRy,SPx,SPy; /* Box:     Sum of Rx,Px,...
  91.                               Gadget:  SRx: TextID
  92.                             */
  93.    USHORT XSpace,YSpace;
  94.    UBYTE  LeftCSpace,RightCSpace,TopCSpace,BottomCSpace;
  95.    UBYTE  LeftPSpace,RightPSpace,TopPSpace,BottomPSpace;
  96.    USHORT Flags; /* GG_FLAG ... */
  97. };
  98.  
  99. struct Box {
  100.    struct GadDim Dim;
  101.    struct Hook *Backfill;
  102.    struct Box **Entry;
  103. };
  104.  
  105. struct WinInfo {
  106.    struct Box *Box;
  107.    struct Gadget **Gadgets;
  108.    struct Gadget *Prev;
  109.    struct Window *Window;
  110.    struct Gadget *GList;
  111.    int FontX,FontY;
  112.    struct TextAttr TextAttr;
  113.    APTR Visual;
  114.    char Mode,Render;
  115. };
  116.  
  117. struct GadInfo {
  118.    struct GadDim Dim;
  119.    int GadNum;
  120.  
  121.    int __stdargs (*CustomFunc)(struct WinInfo *WInfo,
  122.                      struct NewGadget *NewGad,
  123.                      struct GadInfo *GadInfo,
  124.                      int Left, int Top, int Width, int Height);
  125.  
  126.    struct TextAttr *TextAttr;
  127.    const char *Text;
  128.    int GadgetID;
  129.    ULONG Flags,UserData;
  130.    int __stdargs (*HookFunc)(struct IntuiMessage *);
  131.    ULONG *Tags;
  132.    ULONG *SaveTags;
  133.    ULONG Code;
  134.    struct Gadget *ThisGad;
  135. };
  136.  
  137. struct GG_ObjectSize {
  138.    int Width,Height;
  139. };
  140.  
  141. void GG_GfxPrintSize(struct RastPort *rast,const char *text,struct GG_ObjectSize *size);
  142. void GG_GfxPrint(struct RastPort *rast,const char *text,int left,int top);
  143. int  GG_RenderGui(struct Window *win, struct WinInfo *winfo);
  144. int  GG_SmartRenderGui(struct Window *win, struct WinInfo *winfo,struct TextFont **);
  145. int  GG_ResizeGui(struct WinInfo *winfo);
  146. int  GG_RefreshGui(struct WinInfo *winfo);
  147. void GG_FreeGui(struct WinInfo *winfo);
  148. void GG_StopGui(struct WinInfo *winfo);
  149. int  GG_SubGui(struct WinInfo *, struct WinInfo *,int ,int ,int , int );
  150. void GG_ClearWindow(struct Window *);
  151. struct IntuiMessage *GG_GetIMsg(struct MsgPort *userport);
  152. BOOL GG_SetGadgetAttrs(struct Gadget *,struct Window *,struct Requester *, ULONG ,...);
  153. BOOL GG_SetGadgetAttrsA(struct Gadget *,struct Window *,struct Requester *, ULONG *);
  154. void GG_MinSize(struct Window *, struct WinInfo *,struct GG_ObjectSize *);
  155. void GG_MinSizeFont(struct TextFont *, struct WinInfo *,struct GG_ObjectSize *);
  156. BOOL GG_SetLowlevelAttrsA(struct GadInfo *gad, ULONG *Tag);
  157. BOOL GG_SetLowlevelAttrs(struct GadInfo *gad, ULONG Tag1,...);
  158. void GG_BeginResizeGui(struct WinInfo *winfo);
  159. void GG_BeginRefresh(struct WinInfo *winfo);
  160. void GG_EndRefresh(struct WinInfo *winfo, BOOL complete);
  161.  
  162.  
  163. #define GG_ReplyIMsg(s) GT_ReplyIMsg(s);
  164.  
  165. #ifdef GG_OLDSTYLE
  166.  
  167. #define RenderGui             GG_RenderGui
  168. #define ResizeGui             GG_ResizeGui
  169. #define RefreshGui            GG_RefreshGui
  170. #define FreeGui               GG_FreeGui
  171. #define StopGui               GG_StopGui
  172. #define SubGui                GG_SubGui
  173. #define ClearWindow           GG_ClearWindow
  174. #define Gui_SetGadgetAttrs    GG_SetGadgetAttrs
  175. #define Gui_SetGadgetAttrsA   GG_SetGadgetAttrsA
  176.  
  177. static struct IntuiMessage *Gui_GetIMsg(struct MsgPort *port,struct IntuiMessage *msg)
  178. {
  179.    struct IntuiMessage *m;
  180.  
  181.    if(m=GG_GetIMsg(port)) {
  182.       *msg=*m;
  183.       GG_ReplyIMsg(m);
  184.       return msg;
  185.    }
  186.  
  187.    return NULL;
  188. }
  189.  
  190. #define MODE_NEW       GG_MODE_NEW
  191. #define MODE_RESIZE    GG_MODE_RESIZE
  192. #define MODE_REFRESH   GG_MODE_REFRESH
  193. #define MODE_STOP      GG_MODE_STOP
  194. #define MODE_FREE      GG_MODE_FREE
  195. #define MODE_BACKUP    GG_MODE_BACKUP
  196. #define MODE_RESTORE   GG_MODE_RESTORE
  197.  
  198. #define BOXFLG_CUSTOM         GG_FLAG_CUSTOM
  199. #define BOXFLG_STRING         GG_FLAG_STRING
  200. #define BOXFLG_INTEGER        GG_FLAG_INTEGER
  201. #define BOXFLG_DISABLED       GG_FLAG_DISABLED
  202. #define BOXFLG_RAISED         GG_FLAG_RAISED
  203. #define BOXFLG_RECESSED       GG_FLAG_RECESSED
  204. #define BOXFLG_BAR            GG_FLAG_BAR
  205. #define BOXFLG_BACKUP         GG_FLAG_BACKUP
  206. #define BOXFLG_INITED         GG_FLAG_INITED
  207. #define BOXFLG_SKIPREFRESH    GG_FLAG_SKIPREFRESH
  208. #define BOXFLG_DEFAULT_WIDTH  GG_FLAG_DEFAULT_WIDTH
  209. #define BOXFLG_DEFAULT_HEIGHT GG_FLAG_DEFAULT_HEIGHT
  210. #define BOXFLG_TRADEMASK      GG_FLAG_TRADEMASK
  211.  
  212. #define GL_VBOX            GG_VBOX
  213. #define GL_HBOX            GG_HBOX
  214. #define CUSTOM_KIND        GG_CUSTOM_KIND
  215. #define PLAINTEXT_KIND     GG_PLAINTEXT_KIND
  216. #define GFXBUTTON_KIND     GG_GFXBUTTON_KIND
  217.  
  218. #endif
  219.  
  220.  
  221.  
  222. #ifdef __cplusplus
  223. }
  224. #endif
  225. #endif
  226.  
  227.